<?php

/* @var $_this View */
/* @var $form FormHelper */
/* @var $editForm EditFormHelper */
/* @var $html HtmlHelper */
/* @var $ehtml EHtmlHelper */
/* @var $javascript JavascriptHelper */
/* @var $jqax JqaxHelper */
/* @var $filterBlock FilterBlock */

?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><?php
?><html xmlns="http://www.w3.org/1999/xhtml"><?php
?><head><?php
?><?=$html->charset(DEFAULT_CHARSET);?><?php
?><title><?=$title_for_layout;?></title><?php

Page::addCSS('style');
foreach (Page::$css as $i => $file) {
    $attribs = array();
    if (isset(Page::$css_media[$i])) {
        $attribs['media'] = Page::$css_media[$i];
    } else {
        $attribs['media'] = 'All';
    }
    echo $html->css($file, null, $attribs);
}
Page::addJS('jquery-1.2.2.pack');
Page::addJS('main');
Page::addJS('cookies');
foreach (Page::$js as $file) {
    ?><script type="text/javascript" src="<?=Application::rootUrlPath();?>/js/<?=$file;?>.js"></script><?php
}
?><script type="text/javascript">var __sys_img_url_root="<?=Application::imgUrlPath();?>";</script><?php
?><style type="text/css">html {background-color: transparent;background-image: none;}</style><?php
?></head><?php
?><body><?php
    foreach (Page::$jsStrat as $code) {
        ?><?=$javascript->codeBlock($code);?><?php
    }

    ?><?=$this->renderElement("content", array('content_for_layout' => &$content_for_layout));?><?php

    foreach (Page::$jsEnd as $code) {
        ?><?=$javascript->codeBlock($code);?><?php
    }
?></body><?php
?></html><?php

if (Configure::read('debug')) {
    global $request_time, $pre_render_time, $filter_time, $prepare_time;
    $this_time = microtime(true);
    $render_time = $this_time - $pre_render_time;
    $total_time = $this_time - $request_time;
    $prepare_time_str = number_format(($prepare_time), 3, ',', ' ');
    header("X-Render-Time-Prepare: \" ".intval($prepare_time*100/$total_time)."% {$prepare_time_str} s\"");
    $filter_time_str = number_format(($filter_time), 3, ',', ' ');
    header("X-Render-Time-Filter: \" ".intval($filter_time*100/$total_time)."% {$filter_time_str} s\"");
    $render_time_str = number_format(($render_time), 3, ',', ' ');
    header("X-Render-Time-Render: \" ".intval($render_time*100/$total_time)."% {$render_time_str} s\"");
    $total_time_str = number_format(($total_time), 3, ',', ' ');
    header("X-Render-Time: \"100% {$total_time_str} s\"");
}

?>